package net.xconcepts.stockdata.model.tick;

import java.util.Date;
import java.util.Hashtable;
import java.util.Map.Entry;

import net.xconcepts.stockdata.model.analysis.symbol.Symbol;
import net.xconcepts.stockdata.model.analysis.symbol.SymbolFactory;

public class SymbolTick extends Tick {

	private final Symbol mSymbol;
	
	public SymbolTick(String symbol, Date timeStamp,
			Hashtable<TickDataField, Double> data) {
		super(timeStamp, data);
		mSymbol = SymbolFactory.getSymbol(symbol);
	}
	
	public Symbol getSymbol() {
		return mSymbol;
	}

	@Override
	public String toString() {
		final String DELIM = ",";
		
		StringBuilder builder = new StringBuilder();
		
		builder.append(mSymbol.symbolName + DELIM + timeStamp);
	
		
		for(Entry<TickDataField, Double> entry : mData.entrySet()) {
			builder.append(DELIM + entry.getValue());
		}
		
		
		return builder.toString();
	}
	
}
